# 文件: my_robot_nav/launch/driver_bridge.launch.py
import os
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration

def generate_launch_description():
    pkg_name = 'b2_tf_pub'
    pkg_share = get_package_share_directory(pkg_name)
    config_path = os.path.join(pkg_share, 'config', 'parameters.yaml')

    use_sim_time = LaunchConfiguration('use_sim_time')
    
    driver_node = Node(
        package=pkg_name,
        executable='odom_tf_pub',
        name='data_synchronizer',
        output='screen',
        parameters=[
            config_path, 
            {'use_sim_time': use_sim_time}
        ]
    )
    
    return LaunchDescription([
        DeclareLaunchArgument('use_sim_time', default_value='false'),
        driver_node
    ])